package com.felix.demo;

import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import lombok.AllArgsConstructor;
import lombok.Data;

import java.util.Comparator;
import java.util.Date;
import java.util.List;

/**
 * Dog
 *
 * @author xuejinhua
 * @date 2018/11/19 16:24
 */
@Data
@AllArgsConstructor
public class Dog {
    private Date birthday;
}

class Test {
    public static void main(String[] args) {
        Dog d1 = new Dog(new Date(2018, 18, 19));
        Dog d2 = new Dog(new Date(2018, 18, 12));
        Dog d3 = new Dog(new Date(2018, 18, 13));
        Dog d4 = new Dog(new Date(2018, 18, 14));
        Dog d5 = new Dog(new Date(2018, 18, 13));
        Dog d6 = new Dog(new Date(2018, 18, 11));
        List<Dog> list = Lists.newArrayList(d1, d2, d3, d4, d5, d6);
        list = Lists.newArrayList(Sets.newHashSet(list));
        list.sort(Comparator.comparing(Dog::getBirthday));
        System.out.println(list);
    }
}
